显式转换:在编程/语言学语境中,指需要程序员明确写出的类型或形式转换(如使用强制类型转换、转换函数等),以把一个值从一种类型转换为另一种类型;通常用于避免歧义,并提醒可能存在精度丢失或范围溢出。(在不同语言中也常与“强制类型转换 cast”相关;与 implicit conversion 相对。)
/ɪkˈsplɪsɪt kənˈvɝːʒən/
Use an explicit conversion to turn the number into an integer.
用显式转换把这个数字变成整数。
Although the expression compiles, an explicit conversion is required to avoid accidental data loss when converting from double to int.
尽管这个表达式能编译,但从 double 转成 int 时仍需要显式转换,以避免意外的数据丢失。
explicit 源自拉丁语 explicitus,本义有“展开的、说清楚的”,引申为“明确的、明示的”;conversion 来自拉丁语 conversio,意为“转变、转换”。合起来强调“把转换写出来、说清楚”,而不是让系统自动推断。